﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace shenghua.Migrations
{
    public partial class addentity11 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "Title",
                table: "MemberCoupons",
                newName: "Name");

            migrationBuilder.RenameColumn(
                name: "EndTime",
                table: "MemberCoupons",
                newName: "TimeLimit_End");

            migrationBuilder.RenameColumn(
                name: "BeginTime",
                table: "MemberCoupons",
                newName: "TimeLimit_Begin");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "ShoppingCartCommodities",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<int>(
                name: "ShoppingOptionId",
                table: "ShoppingCartCommodities",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "BeginTime",
                table: "SalesPromotions",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<DateTime>(
                name: "EndTime",
                table: "SalesPromotions",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "Name",
                table: "SalesPromotions",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "TargetType",
                table: "MemberCoupons",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Condition_MinAmount_MoneyType",
                table: "MemberCoupons",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "Condition_MinAmount_Value",
                table: "MemberCoupons",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<string>(
                name: "AppliedCommodityIds_StringValue",
                table: "MemberCoupons",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Condition_MinCount",
                table: "MemberCoupons",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "CollectionCommodities",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    MemberId = table.Column<long>(nullable: false),
                    CommodityId = table.Column<int>(nullable: false),
                    ShoppingOptionId = table.Column<int>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CollectionCommodities", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "CollectionCommodities");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "ShoppingCartCommodities");

            migrationBuilder.DropColumn(
                name: "ShoppingOptionId",
                table: "ShoppingCartCommodities");

            migrationBuilder.DropColumn(
                name: "BeginTime",
                table: "SalesPromotions");

            migrationBuilder.DropColumn(
                name: "EndTime",
                table: "SalesPromotions");

            migrationBuilder.DropColumn(
                name: "Name",
                table: "SalesPromotions");

            migrationBuilder.DropColumn(
                name: "TargetType",
                table: "MemberCoupons");

            migrationBuilder.DropColumn(
                name: "Condition_MinAmount_MoneyType",
                table: "MemberCoupons");

            migrationBuilder.DropColumn(
                name: "Condition_MinAmount_Value",
                table: "MemberCoupons");

            migrationBuilder.DropColumn(
                name: "AppliedCommodityIds_StringValue",
                table: "MemberCoupons");

            migrationBuilder.DropColumn(
                name: "Condition_MinCount",
                table: "MemberCoupons");

            migrationBuilder.RenameColumn(
                name: "Name",
                table: "MemberCoupons",
                newName: "Title");

            migrationBuilder.RenameColumn(
                name: "TimeLimit_End",
                table: "MemberCoupons",
                newName: "EndTime");

            migrationBuilder.RenameColumn(
                name: "TimeLimit_Begin",
                table: "MemberCoupons",
                newName: "BeginTime");
        }
    }
}
